package common

type PageResponse struct {
	Total    int64
	PageInfo PageRequest
}

type PageRequest struct {
	PageNum  int `json:"pageNum"`
	PageSize int `json:"pageSize"`
}

func PageHandle(pageRequest PageRequest) (offset int, limit int) {

	pageNum := pageRequest.PageNum
	pageSize := pageRequest.PageSize

	if pageNum == 1 {
		offset = 0
	} else {
		offset = pageSize * pageNum
	}
	limit = pageSize

	return offset, limit
}
